package com.xzzz.backend.blog.server.base.user;

import com.xzzz.backend.blog.server.base.user.pojo.GuardcatUserRes;
import com.xzzz.common.base.pojo.R;
import com.xzzz.irda.auth.core.annotation.AuthIgnore;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 用户 [User]
 *
 * @order 1
 */
@RestController
@RequestMapping("/user")
@AllArgsConstructor
public class UserController {
    private final UserService userService;

    /**
     * 查询用户
     *
     * @return 用户信息
     */
    @AuthIgnore
    @GetMapping("/info")
    public R<GuardcatUserRes> user() {
        GuardcatUserRes user = userService.selectByUsername("xzzz").to(GuardcatUserRes.class);
        return R.ok(user);
    }

}
